# 超级鹰 vs 超级鹰
from selenium.webdriver import Chrome
from chaojiying import Chaojiying_Client
from selenium.webdriver import ActionChains
import time

web = Chrome()
web.get("https://www.chaojiying.com/")

userName = "18074260828"
password = "try18074260828"
verifyCode = ""

# 鼠标悬浮
hover = web.find_element('xpath', '//*[@id="login-register"]')
ActionChains(web).move_to_element(hover).perform()
time.sleep(1)
# 填写账号密码
web.find_element('xpath', '//*[@id="user"]').send_keys(userName)
web.find_element('xpath', '//*[@id="pass"]').send_keys(password)
# 获取图片信息
img = web.find_element('xpath', '//*[@id="userone"]/section/form/div[3]/div/img').screenshot_as_png
chaojiying = Chaojiying_Client(userName, password, '946031')
dic = chaojiying.PostPic(img, 1902)
verifyCode = dic['pic_str']
# 填写验证码
web.find_element('xpath', '//*[@id="auth"]').send_keys(verifyCode)
time.sleep(1)

# 登录
web.find_element('xpath', '//*[@id="userone"]/section/form/div[6]/button').click()

input()

